
!------------------------------------------------------------------------!
!  The Community Multiscale Air Quality (CMAQ) system software is in     !
!  continuous development by various groups and is based on information  !
!  from these groups: Federal Government employees, contractors working  !
!  within a United States Government contract, and non-Federal sources   !
!  including research institutions.  These groups give the Government    !
!  permission to use, prepare derivative works of, and distribute copies !
!  of their work in the CMAQ system to the public and to permit others   !
!  to do so.  The United States Environmental Protection Agency          !
!  therefore grants similar permission to use the CMAQ system software,  !
!  but users are requested to provide copies of derivative works or      !
!  products designed to operate in the CMAQ system to the United States  !
!  Government without restrictions as to use by others.  Software        !
!  that is used with the CMAQ system but distributed under the GNU       !
!  General Public License or the GNU Lesser General Public License is    !
!  subject to their copyright restrictions.                              !
!------------------------------------------------------------------------!


      SUBROUTINE HRG2( DTC )
C**********************************************************************
C
C  FUNCTION: To solve for the concentration of HO, HO2, HONO, and
C            HNO4 alebraically.
C
C  PRECONDITIONS: For the CRACMM2 mechanism
C
C  KEY SUBROUTINES/FUNCTIONS CALLED: None
C
C  REVISION HISTORY: Created by EBI solver program, Mar 15, 2024
C
C   18 Jul 14 B.Hutzell: revised to use real(8) variables
C**********************************************************************
      USE HRDATA

      IMPLICIT NONE


C..INCLUDES: None


C..ARGUMENTS:
      REAL( 8 ), INTENT( IN ) :: DTC                      ! Time step

C..PARAMETERS: None


C..EXTERNAL FUNCTIONS: NONE


C..SAVED LOCAL VARIABLES:
!     CHARACTER( 16 ), SAVE :: PNAME = 'HRG2'             ! Program name


C..SCRATCH LOCAL VARIABLES:
      REAL( 8 ) ::    O1D_S                 ! sum of O1D loss frequencies
      REAL( 8 ) ::    OH_S                  ! stoich coeff for OH from O1D+H2O or H2
      REAL( 8 ) ::    HO2_S                 ! stoich coeff for HO2 from O1D+H2 rxn
      REAL( 8 ) ::    XOH_S                 ! stoich coeff for OH & HONO from NO2EX loss rxn
      REAL( 8 ) ::    R4_19                 ! production of OH from HONO
      REAL( 8 ) ::    R19_4                 ! production of HONO from OH
      REAL( 8 ) ::    R4_5                  ! production of OH from HO2
      REAL( 8 ) ::    R5_4                  ! production of HO2 from OH
      REAL( 8 ) ::    R5_21                 ! production of HO2 from HNO4
      REAL( 8 ) ::    R21_5                 ! production of HNO4 from HO2
      REAL( 8 ) ::    P4, P5, P19, P21      ! species production form other paths
      REAL( 8 ) ::    L4, L5, L19, L21      ! species loss terms

      REAL( 8 ) ::    A, B, C               ! coeffs of quadratic eq. for HO2
      REAL( 8 ) ::    Q                     ! intermediate term

      REAL( 8 ) ::    T1, T2, T3            ! intermediate terms

      REAL( 8 ) ::    L21_INV               ! reciprocal of HNO4 loss term

C**********************************************************************


c..stoichiometric coefficient for production of HOX from O3 via O1D
      O1D_S =                 RKI(    47 )                        ! O1D=O3P
     &      +                 RKI(    48 )                        ! O1D=O3P
     &      +                 RKI(    49 )                        ! O1D=0.2000D+01*HO

      OH_S =    2.0000D+00 * RKI(    49 )                        ! O1D=0.2000D+01*HO

      OH_S  = OH_S / O1D_S


c..Production of HO from HO2 (r4,5 terms )
      R4_5 =                 RKI(    42 ) * YC ( O3          )   ! HO2+O3=HO
     &     +                 RKI(    57 ) * YC ( NO          )   ! HO2+NO=HO+NO2
     &     +    7.0000D-01 * RKI(    66 ) * YC ( NO3         )   ! HO2+NO3=0.7000D+...
     &     +    5.0000D-01 * RKI(    93 ) * YC ( ISOP        )   ! HO2+ISOP=0.5000D+...
     &     +    4.5000D-01 * RKI(    97 ) * YC ( INO2        )   ! HO2+INO2=0.4500D+...
     &     +    2.3800D-01 * RKI(   236 ) * YC ( APIP1       )   ! HO2+APIP1=...
     &     +    6.1950D-01 * RKI(   238 ) * YC ( APINP1      )   ! HO2+APINP1=...
     &     +    1.0000D-01 * RKI(   240 ) * YC ( LIMP1       )   ! HO2+LIMP1=...
     &     +    5.0000D-01 * RKI(   242 ) * YC ( LIMNP1      )   ! HO2+LIMNP1=...
     &     +    2.5000D-01 * RKI(   244 ) * YC ( PINALP      )   ! HO2+PINALP=...
     &     +    1.0000D-01 * RKI(   245 ) * YC ( LIMALP      )   ! HO2+LIMALP=...
     &     +    4.4000D-01 * RKI(   246 ) * YC ( ACO3        )   ! HO2+ACO3=0.4400D+...
     &     +    4.4000D-01 * RKI(   247 ) * YC ( RCO3        )   ! HO2+RCO3=0.4400D+...
     &     +    1.5000D-01 * RKI(   248 ) * YC ( ACTP        )   ! HO2+ACTP=0.1500D+...
     &     +    4.0000D-01 * RKI(   407 ) * YC ( FURANO2     )   ! HO2+FURANO2=...

      R4_5  = R4_5 * DTC

c..Production of HO from HONO (r4,19 terms )
      R4_19 =                 RKI(     7 )                        ! HONO=HO+NO

      R4_19 = R4_19 * DTC

c..Remaining HO production
      P4 =    2.0000D+00 * RXRAT(     3 )      ! H2O2=0.2000D+01*HO
     &   +                 RXRAT(     8 )      ! HNO3=HO+NO2
     &   +    2.0000D-01 * RXRAT(     9 )      ! HNO4=0.2000D+00*HO+0.8000D+...
     &   +    3.4000D-01 * RXRAT(    22 )      ! MACR=0.3400D+00*HO+0.6600D+...
     &   +                 RXRAT(    31 )      ! OP1=HO+HO2+HCHO
     &   +                 RXRAT(    32 )      ! OP2=HO+HO2+ALD
     &   +                 RXRAT(    33 )      ! OPB=HO+HO2+ALD
     &   +                 RXRAT(    34 )      ! OP3=HO+HO2+ALD
     &   +                 RXRAT(    35 )      ! PAA=HO+MO2
     &   +   OH_S  *       RXRAT(     2 )      ! O1D=0.2000D+01*HO
     &   +    2.5000D-01 * RXRAT(    90 )      ! ISO+O3=0.2500D+00*HO+...
     &   +                 RXRAT(    96 )      ! ISHP+HO=0.2000D+01*HO+...
     &   +    8.0000D-02 * RXRAT(   144 )      ! ETE+O3=0.8000D-01*HO+...
     &   +    2.2000D-01 * RXRAT(   145 )      ! OLT+O3=0.2200D+00*HO+...
     &   +    4.6000D-01 * RXRAT(   146 )      ! OLI+O3=0.4600D+00*HO+...
     &   +    6.0550D-01 * RXRAT(   147 )      ! API+O3=0.6055D+00*HO+...
     &   +    6.6000D-01 * RXRAT(   148 )      ! LIM+O3=0.6600D+00*HO+...
     &   +    9.0000D-02 * RXRAT(   149 )      ! LIMAL+O3=0.9000D-01*HO+ALD+...
     &   +    1.9000D-01 * RXRAT(   151 )      ! MACR+O3=0.1900D+00*HO+...
     &   +    1.6000D-01 * RXRAT(   152 )      ! MVK+O3=0.1600D+00*HO+...
     &   +    1.0000D-01 * RXRAT(   153 )      ! UALD+O3=0.1000D+00*HO+...
     &   +    5.0000D-02 * RXRAT(   154 )      ! DCB1+O3=0.5000D-01*HO+HO2+...
     &   +    5.0000D-02 * RXRAT(   155 )      ! DCB2+O3=0.5000D-01*HO+HO2+...
     &   +    5.0000D-02 * RXRAT(   156 )      ! DCB3+O3=0.5000D-01*HO+HO2+...
     &   +    8.2000D-01 * RXRAT(   195 )      ! APIP2+NO=0.8200D+00*HO+...
     &   +    8.2000D-01 * RXRAT(   197 )      ! APINP2+NO=0.8200D+00*HO+...
     &   +    7.7000D-01 * RXRAT(   199 )      ! LIMP2+NO=0.7700D+00*HO+...
     &   +    7.7000D-01 * RXRAT(   201 )      ! LIMNP2+NO=0.7700D+00*HO+...
     &   +    5.0000D-01 * RXRAT(   313 )      ! APIP2+ACO3=0.5000D+00*HO+...
     &   +    5.0000D-01 * RXRAT(   317 )      ! LIMP2+ACO3=0.5000D+00*HO+...
     &   +    4.8000D-01 * RXRAT(   378 )      ! APIP2+APIP1=0.4800D+00*HO+...
     &   +    4.8000D-01 * RXRAT(   379 )      ! APIP2+LIMP1=0.4800D+00*HO+...
     &   +    4.8000D-01 * RXRAT(   380 )      ! APIP2+ISOP=0.4800D+00*HO+...
     &   +    4.8000D-01 * RXRAT(   381 )      ! LIMP2+APIP1=0.4800D+00*HO+...
     &   +    4.8000D-01 * RXRAT(   382 )      ! LIMP2+LIMP1=0.4800D+00*HO+...
     &   +    4.8000D-01 * RXRAT(   383 )      ! LIMP2+ISOP=0.4800D+00*HO+...
     &   +    2.8000D-01 * RXRAT(   394 )      ! ACRO+O3=0.2800D+00*HO+...
     &   +    2.0400D-01 * RXRAT(   396 )      ! ACRO=0.2040D+00*HO+0.4770D+...
     &   +    8.0000D-02 * RXRAT(   403 )      ! BDE13+O3=0.8000D-01*HO+...
     &   +    2.0000D-02 * RXRAT(   409 )      ! FURAN+O3=0.2000D-01*HO+ALD

      P4 = YC0( HO ) + P4 * DTC

c..Production of HO2 from OH ( r5,4 terms )
      R5_4 =                 RKI(    41 ) * YC ( O3          )   ! HO+O3=HO2
     &     +                 RKI(    50 )                        ! HO=HO2
     &     +                 RKI(    54 ) * YC ( H2O2        )   ! HO+H2O2=HO2
     &     +                 RKI(    65 ) * YC ( NO3         )   ! HO+NO3=HO2+NO2
     &     +                 RKI(    76 ) * YC ( SO2         )   ! HO+SO2=HO2+SULF+...
     &     +                 RKI(    77 ) * YC ( CO          )   ! HO+CO=HO2
     &     +    3.5000D-01 * RKI(    85 ) * YC ( ACE         )   ! HO+ACE=0.3500D+...
     &     +    5.3000D-01 * RKI(    86 ) * YC ( BEN         )   ! HO+BEN=0.5300D+...
     &     +    1.8000D-01 * RKI(    87 ) * YC ( TOL         )   ! HO+TOL=0.1800D+...
     &     +    1.7000D-01 * RKI(    88 ) * YC ( XYL         )   ! HO+XYL=0.1700D+...
     &     +    1.8000D-01 * RKI(    89 ) * YC ( EBZ         )   ! HO+EBZ=0.1800D+...
     &     +    3.0000D-01 * RKI(   100 ) * YC ( INALD       )   ! HO+INALD=0.3000D+...
     &     +                 RKI(   107 ) * YC ( HCHO        )   ! HO+HCHO=HO2+CO
     &     +                 RKI(   113 ) * YC ( HKET        )   ! HO+HKET=HO2+MGLY
     &     +                 RKI(   117 ) * YC ( GLY         )   ! HO+GLY=HO2+...
     &     +    5.2000D-01 * RKI(   119 ) * YC ( DCB1        )   ! HO+DCB1=0.5200D+...
     &     +    5.2000D-01 * RKI(   120 ) * YC ( DCB2        )   ! HO+DCB2=0.5200D+...
     &     +    5.6000D-01 * RKI(   121 ) * YC ( DCB3        )   ! HO+DCB3=0.5600D+...
     &     +    6.1900D-01 * RKI(   123 ) * YC ( PHEN        )   ! HO+PHEN=0.6190D+...
     &     +    5.8400D-01 * RKI(   124 ) * YC ( CSL         )   ! HO+CSL=0.5840D+...
     &     +                 RKI(   126 ) * YC ( MOH         )   ! HO+MOH=HO2+HCHO
     &     +                 RKI(   127 ) * YC ( EOH         )   ! HO+EOH=HO2+ACD
     &     +                 RKI(   128 ) * YC ( ROH         )   ! HO+ROH=HO2+...
     &     +                 RKI(   129 ) * YC ( ETEG        )   ! HO+ETEG=HO2+ALD
     &     +                 RKI(   135 ) * YC ( ORA1        )   ! HO+ORA1=HO2
     &     +    3.3300D-01 * RKI(   397 ) * YC ( BDE13       )   ! HO+BDE13=0.3330D+...
     &     +    4.9000D-01 * RKI(   405 ) * YC ( FURAN       )   ! HO+FURAN=0.4900D+...
     &     +    6.6000D-01 * RKI(   408 ) * YC ( FURANONE    )   ! HO+FURANONE=...
     &     +                 RKI(   411 ) * YC ( PROG        )   ! HO+PROG=HO2+...
     &     +    1.6000D-01 * RKI(   489 ) * YC ( VROCP6ARO   )   ! HO+VROCP6ARO=...
     &     +    1.6000D-01 * RKI(   495 ) * YC ( VROCP5ARO   )   ! HO+VROCP5ARO=...
     &     +    1.6000D-01 * RKI(   501 ) * YC ( NAPH        )   ! HO+NAPH=0.1600D+...

      R5_4  = R5_4 * DTC

c..Production of HO2 from HNO4 (r5,21 term )
      R5_21 =    8.0000D-01 * RKI(     9 )                        ! HNO4=0.8000D+...
     &      +                 RKI(    74 )                        ! HNO4=HO2+NO2

      R5_21 = R5_21 * DTC

c..Remaining HO2 production terms
      P5 =    2.0000D+00 * RXRAT(    11 )      ! HCHO=0.2000D+01*HO2+CO
     &   +                 RXRAT(    12 )      ! ACD=HO2+MO2+CO
     &   +                 RXRAT(    13 )      ! ALD=HO2+ETHP+CO
     &   +    1.2200D+00 * RXRAT(    16 )      ! UALD=0.1220D+01*HO2+...
     &   +                 RXRAT(    17 )      ! PINAL=HO2+HC10P+CO
     &   +                 RXRAT(    18 )      ! LIMAL=HO2+HC10P+CO
     &   +                 RXRAT(    21 )      ! HKET=HO2+ACO3+HCHO
     &   +    6.6000D-01 * RXRAT(    22 )      ! MACR=0.6600D+00*HO2+...
     &   +    2.0000D+00 * RXRAT(    26 )      ! GLY=0.2000D+01*HO2+0.2000D+...
     &   +                 RXRAT(    27 )      ! MGLY=HO2+ACO3+CO
     &   +    1.5000D+00 * RXRAT(    28 )      ! DCB1=0.1500D+01*HO2+...
     &   +    1.5000D+00 * RXRAT(    29 )      ! DCB2=0.1500D+01*HO2+...
     &   +                 RXRAT(    30 )      ! BALD=HO2+CHO+CO
     &   +                 RXRAT(    31 )      ! OP1=HO2+HO+HCHO
     &   +                 RXRAT(    32 )      ! OP2=HO2+HO+ALD
     &   +                 RXRAT(    33 )      ! OPB=HO2+HO+ALD
     &   +                 RXRAT(    34 )      ! OP3=HO2+HO+ALD
     &   +                 RXRAT(    36 )      ! ONIT=HO2+NO2+0.2000D+...
     &   +    2.5000D-01 * RXRAT(    90 )      ! ISO+O3=0.2500D+00*HO2+...
     &   +    8.8000D-01 * RXRAT(    94 )      ! ISOP+NO=0.8800D+00*HO2+...
     &   +    3.4000D-01 * RXRAT(    96 )      ! ISHP+HO=0.3400D+00*HO2+...
     &   +    1.5000D-01 * RXRAT(   144 )      ! ETE+O3=0.1500D+00*HO2+...
     &   +    3.2000D-01 * RXRAT(   145 )      ! OLT+O3=0.3200D+00*HO2+...
     &   +    7.0000D-02 * RXRAT(   146 )      ! OLI+O3=0.7000D-01*HO2+...
     &   +    1.1050D-01 * RXRAT(   147 )      ! API+O3=0.1105D+00*HO2+...
     &   +    1.4000D-01 * RXRAT(   151 )      ! MACR+O3=0.1400D+00*HO2+...
     &   +    1.1000D-01 * RXRAT(   152 )      ! MVK+O3=0.1100D+00*HO2+...
     &   +    7.2000D-02 * RXRAT(   153 )      ! UALD+O3=0.7200D-01*HO2+...
     &   +                 RXRAT(   154 )      ! DCB1+O3=HO2+0.5000D-01*HO+...
     &   +                 RXRAT(   155 )      ! DCB2+O3=HO2+0.5000D-01*HO+...
     &   +                 RXRAT(   156 )      ! DCB3+O3=HO2+0.5000D-01*HO+...
     &   +                 RXRAT(   164 )      ! HCHO+NO3=HO2+CO+HNO3
     &   +                 RXRAT(   168 )      ! UALD+NO3=HO2+XO2+0.6680D+...
     &   +                 RXRAT(   169 )      ! GLY+NO3=HO2+0.2000D+01*CO+HNO3
     &   +                 RXRAT(   183 )      ! MO2+NO=HO2+NO2+HCHO
     &   +                 RXRAT(   184 )      ! ETHP+NO=HO2+NO2+ACD
     &   +    6.6000D-01 * RXRAT(   185 )      ! HC3P+NO=0.6600D+00*HO2+...
     &   +    2.0000D-01 * RXRAT(   186 )      ! HC5P+NO=0.2000D+00*HO2+...
     &   +                 RXRAT(   187 )      ! ETEP+NO=HO2+NO2+0.1600D+...
     &   +    7.8000D-01 * RXRAT(   188 )      ! OLTP+NO=0.7800D+00*HO2+...
     &   +    8.3000D-01 * RXRAT(   189 )      ! OLIP+NO=0.8300D+00*HO2+...
     &   +    9.9800D-01 * RXRAT(   190 )      ! BENP+NO=0.9980D+00*HO2+...
     &   +    9.9800D-01 * RXRAT(   191 )      ! TOLP+NO=0.9980D+00*HO2+...
     &   +    9.9800D-01 * RXRAT(   192 )      ! XYLP+NO=0.9980D+00*HO2+...
     &   +    9.9800D-01 * RXRAT(   193 )      ! EBZP+NO=0.9980D+00*HO2+...
     &   +    7.6300D-01 * RXRAT(   194 )      ! APIP1+NO=0.7630D+00*HO2+...
     &   +    1.6450D-01 * RXRAT(   196 )      ! APINP1+NO=0.1645D+00*HO2+...
     &   +    7.7000D-01 * RXRAT(   198 )      ! LIMP1+NO=0.7700D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   200 )      ! LIMNP1+NO=0.5000D+00*HO2+...
     &   +    3.6000D-01 * RXRAT(   203 )      ! LIMALP+NO=0.3600D+00*HO2+...
     &   +    6.7000D-01 * RXRAT(   207 )      ! MEKP+NO=0.6700D+00*HO2+NO2+...
     &   +    7.7000D-01 * RXRAT(   208 )      ! KETP+NO=0.7700D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   210 )      ! MCP+NO=0.5000D+00*HO2+NO2+...
     &   +    3.0000D-01 * RXRAT(   211 )      ! MVKP+NO=0.3000D+00*HO2+...
     &   +                 RXRAT(   212 )      ! UALP+NO=HO2+NO2+0.6100D+...
     &   +                 RXRAT(   215 )      ! ADDC+NO=HO2+NO2+0.3200D+...
     &   +                 RXRAT(   217 )      ! ORAP+NO=HO2+GLY+NO2
     &   +                 RXRAT(   218 )      ! OLNN+NO=HO2+NO2+ONIT
     &   +    7.4000D-01 * RXRAT(   263 )      ! MO2+MO2=0.7400D+00*HO2+...
     &   +                 RXRAT(   264 )      ! ETHP+MO2=HO2+0.7500D+...
     &   +    8.9400D-01 * RXRAT(   265 )      ! HC3P+MO2=0.8940D+00*HO2+...
     &   +    8.4200D-01 * RXRAT(   266 )      ! HC5P+MO2=0.8420D+00*HO2+...
     &   +                 RXRAT(   267 )      ! ETEP+MO2=HO2+0.1950D+...
     &   +                 RXRAT(   268 )      ! OLTP+MO2=HO2+0.1500D+...
     &   +                 RXRAT(   269 )      ! OLIP+MO2=HO2+0.7500D+...
     &   +    1.3700D+00 * RXRAT(   270 )      ! BENP+MO2=0.1370D+01*HO2+...
     &   +    1.2846D+00 * RXRAT(   271 )      ! TOLP+MO2=0.1285D+01*HO2+...
     &   +    1.3218D+00 * RXRAT(   272 )      ! XYLP+MO2=0.1322D+01*HO2+...
     &   +    1.2846D+00 * RXRAT(   273 )      ! EBZP+MO2=0.1285D+01*HO2+...
     &   +                 RXRAT(   274 )      ! ISOP+MO2=HO2+0.1310D+...
     &   +    1.2790D+00 * RXRAT(   275 )      ! APIP1+MO2=0.1279D+01*HO2+...
     &   +                 RXRAT(   276 )      ! APIP2+MO2=HO2+0.7500D+...
     &   +    9.1800D-01 * RXRAT(   277 )      ! APINP1+MO2=0.9180D+00*HO2+...
     &   +    7.5000D-01 * RXRAT(   278 )      ! APINP2+MO2=0.7500D+00*HO2+...
     &   +                 RXRAT(   279 )      ! LIMP1+MO2=HO2+LIMAL+...
     &   +                 RXRAT(   280 )      ! LIMP2+MO2=HO2+0.7500D+...
     &   +    1.0100D+00 * RXRAT(   281 )      ! LIMNP1+MO2=0.1010D+01*HO2+...
     &   +    7.5000D-01 * RXRAT(   282 )      ! LIMNP2+MO2=0.7500D+00*HO2+...
     &   +    9.0000D-01 * RXRAT(   283 )      ! ACO3+MO2=0.9000D+00*HO2+...
     &   +    9.0000D-01 * RXRAT(   284 )      ! RCO3+MO2=0.9000D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   285 )      ! ACTP+MO2=0.5000D+00*HO2+...
     &   +    8.3400D-01 * RXRAT(   286 )      ! MEKP+MO2=0.8340D+00*HO2+...
     &   +                 RXRAT(   287 )      ! KETP+MO2=HO2+0.7500D+...
     &   +    5.0000D-01 * RXRAT(   288 )      ! MACP+MO2=0.5000D+00*HO2+...
     &   +                 RXRAT(   289 )      ! MCP+MO2=HO2+NO2+0.1500D+...
     &   +                 RXRAT(   290 )      ! MVKP+MO2=HO2+0.1160D+...
     &   +                 RXRAT(   291 )      ! UALP+MO2=HO2+0.3050D+00*CO+...
     &   +                 RXRAT(   292 )      ! BALP+MO2=HO2+BAL1+HCHO
     &   +                 RXRAT(   293 )      ! BAL1+MO2=HO2+BAL2+HCHO
     &   +    2.0000D+00 * RXRAT(   294 )      ! ADDC+MO2=0.2000D+01*HO2+...
     &   +                 RXRAT(   295 )      ! MCTP+MO2=HO2+MCTO+HCHO
     &   +                 RXRAT(   296 )      ! ORAP+MO2=HO2+HCHO+GLY
     &   +    2.0000D+00 * RXRAT(   297 )      ! OLNN+MO2=0.2000D+01*HO2+...
     &   +    5.0000D-01 * RXRAT(   298 )      ! OLND+MO2=0.5000D+00*HO2+...
     &   +                 RXRAT(   299 )      ! ADCN+MO2=HO2+0.7000D+...
     &   +                 RXRAT(   300 )      ! XO2+MO2=HO2+HCHO
     &   +    5.0000D-01 * RXRAT(   301 )      ! ETHP+ACO3=0.5000D+00*HO2+...
     &   +    3.9400D-01 * RXRAT(   302 )      ! HC3P+ACO3=0.3940D+00*HO2+...
     &   +    3.4200D-01 * RXRAT(   303 )      ! HC5P+ACO3=0.3420D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   304 )      ! ETEP+ACO3=0.5000D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   305 )      ! OLTP+ACO3=0.5000D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   306 )      ! OLIP+ACO3=0.5000D+00*HO2+...
     &   +                 RXRAT(   307 )      ! BENP+ACO3=HO2+0.7000D+...
     &   +    9.1460D-01 * RXRAT(   308 )      ! TOLP+ACO3=0.9146D+00*HO2+...
     &   +    9.5180D-01 * RXRAT(   309 )      ! XYLP+ACO3=0.9518D+00*HO2+...
     &   +    9.1460D-01 * RXRAT(   310 )      ! EBZP+ACO3=0.9146D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   311 )      ! ISOP+ACO3=0.5000D+00*HO2+...
     &   +                 RXRAT(   312 )      ! APIP1+ACO3=HO2+0.3710D+...
     &   +    1.7500D-01 * RXRAT(   314 )      ! APINP1+ACO3=0.1750D+00*HO2+...
     &   +                 RXRAT(   316 )      ! LIMP1+ACO3=HO2+0.5600D+...
     &   +    5.4000D-01 * RXRAT(   318 )      ! LIMNP1+ACO3=0.5400D+00*HO2+...
     &   +    3.3000D-01 * RXRAT(   323 )      ! MEKP+ACO3=0.3300D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   324 )      ! KETP+ACO3=0.5000D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   326 )      ! MCP+ACO3=0.5000D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   327 )      ! MVKP+ACO3=0.5000D+00*HO2+...
     &   +    5.0000D-01 * RXRAT(   328 )      ! UALP+ACO3=0.5000D+00*HO2+...
     &   +    2.0000D+00 * RXRAT(   331 )      ! ADDC+ACO3=0.2000D+01*HO2+...
     &   +                 RXRAT(   332 )      ! MCTP+ACO3=HO2+MO2+MCTO
     &   +                 RXRAT(   334 )      ! OLNN+ACO3=HO2+MO2+ONIT
     &   +                 RXRAT(   336 )      ! ADCN+ACO3=HO2+MO2+0.7000D+...
     &   +                 RXRAT(   339 )      ! MO2+NO3=HO2+HCHO+NO2
     &   +                 RXRAT(   340 )      ! ETHP+NO3=HO2+NO2+ACD
     &   +    2.5400D-01 * RXRAT(   341 )      ! HC3P+NO3=0.2540D+00*HO2+...
     &   +    4.8800D-01 * RXRAT(   342 )      ! HC5P+NO3=0.4880D+00*HO2+...
     &   +                 RXRAT(   343 )      ! ETEP+NO3=HO2+NO2+0.1600D+...
     &   +    7.9000D-01 * RXRAT(   344 )      ! OLTP+NO3=0.7900D+00*HO2+...
     &   +    8.6000D-01 * RXRAT(   345 )      ! OLIP+NO3=0.8600D+00*HO2+...
     &   +                 RXRAT(   346 )      ! BENP+NO3=HO2+NO2+0.0000D+...
     &   +    9.1460D-01 * RXRAT(   347 )      ! TOLP+NO3=0.9146D+00*HO2+...
     &   +    9.5180D-01 * RXRAT(   348 )      ! XYLP+NO3=0.9518D+00*HO2+...
     &   +    9.1460D-01 * RXRAT(   349 )      ! EBZP+NO3=0.9146D+00*HO2+...
     &   +                 RXRAT(   350 )      ! ISOP+NO3=HO2+NO2+0.7500D+...
     &   +                 RXRAT(   351 )      ! APIP1+NO3=HO2+NO2+0.2535D+...
     &   +                 RXRAT(   352 )      ! LIMP1+NO3=HO2+NO2+LIMAL+...
     &   +    1.7500D-01 * RXRAT(   353 )      ! APINP1+NO3=0.1750D+00*HO2+...
     &   +    5.4000D-01 * RXRAT(   354 )      ! LIMNP1+NO3=0.5400D+00*HO2+...
     &   +    6.7000D-01 * RXRAT(   358 )      ! MEKP+NO3=0.6700D+00*HO2+...
     &   +                 RXRAT(   359 )      ! KETP+NO3=HO2+NO2+DCB1
     &   +                 RXRAT(   361 )      ! MCP+NO3=HO2+NO2+HCHO+HKET
     &   +    3.0000D-01 * RXRAT(   362 )      ! MVKP+NO3=0.3000D+00*HO2+...
     &   +                 RXRAT(   363 )      ! UALP+NO3=HO2+NO2+0.6100D+...
     &   +                 RXRAT(   366 )      ! ADDC+NO3=HO2+NO2+0.3200D+...
     &   +                 RXRAT(   368 )      ! ORAP+NO3=HO2+GLY+NO2
     &   +                 RXRAT(   369 )      ! OLNN+NO3=HO2+NO2+ONIT
     &   +                 RXRAT(   372 )      ! OLNN+OLNN=HO2+0.2000D+01*ONIT
     &   +    5.0000D-01 * RXRAT(   373 )      ! OLNN+OLND=0.5000D+00*HO2+...
     &   +    4.8000D-01 * RXRAT(   378 )      ! APIP2+APIP1=0.4800D+00*HO2+...
     &   +    4.8000D-01 * RXRAT(   379 )      ! APIP2+LIMP1=0.4800D+00*HO2+...
     &   +    4.8000D-01 * RXRAT(   380 )      ! APIP2+ISOP=0.4800D+00*HO2+...
     &   +    4.8000D-01 * RXRAT(   381 )      ! LIMP2+APIP1=0.4800D+00*HO2+...
     &   +    4.8000D-01 * RXRAT(   382 )      ! LIMP2+LIMP1=0.4800D+00*HO2+...
     &   +    4.8000D-01 * RXRAT(   383 )      ! LIMP2+ISOP=0.4800D+00*HO2+...
     &   +    4.8000D-01 * RXRAT(   384 )      ! APINP2+APIP1=0.4800D+...
     &   +    4.8000D-01 * RXRAT(   385 )      ! APINP2+LIMP1=0.4800D+...
     &   +    4.8000D-01 * RXRAT(   386 )      ! APINP2+ISOP=0.4800D+00*HO2+...
     &   +    4.8000D-01 * RXRAT(   387 )      ! LIMNP2+APIP1=0.4800D+...
     &   +    4.8000D-01 * RXRAT(   388 )      ! LIMNP2+LIMP1=0.4800D+...
     &   +    4.8000D-01 * RXRAT(   389 )      ! LIMNP2+ISOP=0.4800D+00*HO2+...
     &   +    5.6000D-01 * RXRAT(   394 )      ! ACRO+O3=0.5600D+00*HO2+...
     &   +    4.7700D-01 * RXRAT(   396 )      ! ACRO=0.4770D+00*HO2+...
     &   +    9.6800D-01 * RXRAT(   398 )      ! BDE13P+NO=0.9680D+00*HO2+...
     &   +                 RXRAT(   399 )      ! BDE13P+NO3=HO2+NO2+0.9250D+...
     &   +    8.7000D-01 * RXRAT(   401 )      ! BDE13P+MO2=0.8700D+00*HO2+...
     &   +    8.0000D-01 * RXRAT(   402 )      ! BDE13P+ACO3=0.8000D+00*HO2+...
     &   +    4.2000D-01 * RXRAT(   403 )      ! BDE13+O3=0.4200D+00*HO2+...
     &   +    7.5000D-01 * RXRAT(   406 )      ! FURANO2+NO=0.7500D+00*HO2+...
     &   +                 RXRAT(   461 )      ! VROCP6ALKP2=HO2+VROCP3OXY2
     &   +                 RXRAT(   462 )      ! VROCP5ALKP2=HO2+VROCP2OXY2
     &   +                 RXRAT(   463 )      ! VROCP4ALKP2=HO2+VROCP1OXY1
     &   +                 RXRAT(   464 )      ! VROCP3ALKP2=HO2+VROCP0OXY2
     &   +                 RXRAT(   465 )      ! VROCP2ALKP2=HO2+VROCN1OXY1
     &   +                 RXRAT(   466 )      ! VROCP1ALKP2=HO2+VROCN2OXY2
     &   +                 RXRAT(   467 )      ! HC10P2=HO2+VROCP4OXY2
     &   +    8.6000D-01 * RXRAT(   468 )      ! VROCP6ALKP2+NO=0.8600D+...
     &   +    8.6000D-01 * RXRAT(   469 )      ! VROCP5ALKP2+NO=0.8600D+...
     &   +    8.6000D-01 * RXRAT(   470 )      ! VROCP4ALKP2+NO=0.8600D+...
     &   +    8.6000D-01 * RXRAT(   471 )      ! VROCP3ALKP2+NO=0.8600D+...
     &   +    8.6000D-01 * RXRAT(   472 )      ! VROCP2ALKP2+NO=0.8600D+...
     &   +    8.6000D-01 * RXRAT(   473 )      ! VROCP1ALKP2+NO=0.8600D+...
     &   +    8.8000D-01 * RXRAT(   474 )      ! HC10P2+NO=0.8800D+00*HO2+...
     &   +                 RXRAT(   475 )      ! VROCP6ALKP2+NO3=HO2+...
     &   +                 RXRAT(   476 )      ! VROCP5ALKP2+NO3=HO2+...
     &   +                 RXRAT(   477 )      ! VROCP4ALKP2+NO3=HO2+...
     &   +                 RXRAT(   478 )      ! VROCP3ALKP2+NO3=HO2+...
     &   +                 RXRAT(   479 )      ! VROCP2ALKP2+NO3=HO2+...
     &   +                 RXRAT(   480 )      ! VROCP1ALKP2+NO3=HO2+...
     &   +                 RXRAT(   481 )      ! HC10P2+NO3=HO2+KET+NO2
     &   +    9.9800D-01 * RXRAT(   491 )      ! VROCP6AROP+NO=0.9980D+...
     &   +    9.4050D-01 * RXRAT(   492 )      ! VROCP6AROP+NO3=0.9405D+...
     &   +    1.3105D+00 * RXRAT(   493 )      ! VROCP6AROP+MO2=0.1310D+...
     &   +    9.4050D-01 * RXRAT(   494 )      ! VROCP6AROP+ACO3=0.9405D+...
     &   +    9.9800D-01 * RXRAT(   497 )      ! VROCP5AROP+NO=0.9980D+...
     &   +    9.4050D-01 * RXRAT(   498 )      ! VROCP5AROP+NO3=0.9405D+...
     &   +    1.3105D+00 * RXRAT(   499 )      ! VROCP5AROP+MO2=0.1310D+...
     &   +    9.4050D-01 * RXRAT(   500 )      ! VROCP5AROP+ACO3=0.9405D+...
     &   +    9.9800D-01 * RXRAT(   503 )      ! NAPHP+NO=0.9980D+00*HO2+...
     &   +    9.4050D-01 * RXRAT(   504 )      ! NAPHP+NO3=0.9405D+00*HO2+...
     &   +    1.3105D+00 * RXRAT(   505 )      ! NAPHP+MO2=0.1310D+01*HO2+...
     &   +    9.4050D-01 * RXRAT(   506 )      ! NAPHP+ACO3=0.9405D+00*HO2+...
     &   +                 RXRAT(   528 )      ! STYP+NO=HO2+NO2+HCHO+BALD
     &   +                 RXRAT(   529 )      ! STYP+NO3=HO2+NO2+HCHO+BALD
     &   +    1.3700D+00 * RXRAT(   530 )      ! STYP+MO2=0.1370D+01*HO2+...
     &   +                 RXRAT(   531 )      ! STYP+ACO3=HO2+HCHO+BALD+...

      P5 = YC0( HO2 ) + P5 * DTC

c..Production of HONO from OH (r19,4 terms )

      R19_4 =   RKI(    56 ) * YC( NO          ) * DTC      ! OH+NO=HONO

c..Remaining HONO production terms
      P19 =    5.0000D-01 * RXRAT(   424 )      ! NO2=0.5000D+00*HONO+...

      P19 = YC0( HONO ) + P19 * DTC

c..Production of HNO4 from HO2 (r21,5 term )

      R21_5 =   RKI(    73 ) * YCP( NO2         ) * DTC      ! HO2+NO2=HNO4

c..Remaining HNO4 production terms
      P21   =   YC0( HNO4 )

c..HO loss terms not in R5_4 & R19_4
      L4 =                 RKI(    51 ) * YC ( HO2         )   ! HO+HO2=
     &   +                 RKI(    60 ) * YC ( HONO        )   ! HO+HONO=NO2
     &   +                 RKI(    63 ) * YC ( NO2         )   ! HO+NO2=HNO3
     &   +                 RKI(    64 ) * YC ( HNO3        )   ! HO+HNO3=NO3
     &   +                 RKI(    75 ) * YC ( HNO4        )   ! HO+HNO4=NO2
     &   +                 RKI(    78 )                        ! HO=MO2
     &   +                 RKI(    79 ) * YC ( ETH         )   ! HO+ETH=ETHP
     &   +                 RKI(    80 ) * YC ( HC3         )   ! HO+HC3=HC3P+...
     &   +                 RKI(    81 ) * YC ( HC5         )   ! HO+HC5=HC5P+...
     &   +                 RKI(    82 ) * YC ( ETE         )   ! HO+ETE=ETEP
     &   +                 RKI(    83 ) * YC ( OLT         )   ! HO+OLT=OLTP
     &   +                 RKI(    84 ) * YC ( OLI         )   ! HO+OLI=OLIP
     &   +    4.7000D-01 * RKI(    86 ) * YC ( BEN         )   ! HO+BEN=0.5300D+...
     &   +    8.2000D-01 * RKI(    87 ) * YC ( TOL         )   ! HO+TOL=0.1800D+...
     &   +    8.3000D-01 * RKI(    88 ) * YC ( XYL         )   ! HO+XYL=0.1700D+...
     &   +    8.2000D-01 * RKI(    89 ) * YC ( EBZ         )   ! HO+EBZ=0.1800D+...
     &   +                 RKI(    92 ) * YC ( ISO         )   ! HO+ISO=ISOP+...
     &   +                 RKI(    95 ) * YC ( ISHP        )   ! HO+ISHP=ISOP
     &   +    7.0000D-01 * RKI(   100 ) * YC ( INALD       )   ! HO+INALD=0.3000D+...
     &   +                 RKI(   102 ) * YC ( IPX         )   ! HO+IPX=0.5700D+...
     &   +                 RKI(   103 ) * YC ( API         )   ! HO+API=0.9750D+...
     &   +                 RKI(   104 ) * YC ( LIM         )   ! HO+LIM=0.9450D+...
     &   +                 RKI(   105 ) * YC ( PINAL       )   ! HO+PINAL=0.2300D+...
     &   +                 RKI(   106 ) * YC ( LIMAL       )   ! HO+LIMAL=0.8300D+...
     &   +                 RKI(   108 ) * YC ( ACD         )   ! HO+ACD=ACO3
     &   +                 RKI(   109 ) * YC ( ALD         )   ! HO+ALD=RCO3
     &   +                 RKI(   110 ) * YC ( ACT         )   ! HO+ACT=ACTP
     &   +                 RKI(   111 ) * YC ( MEK         )   ! HO+MEK=MEKP
     &   +                 RKI(   112 ) * YC ( KET         )   ! HO+KET=KETP
     &   +                 RKI(   114 ) * YC ( MACR        )   ! HO+MACR=0.5700D+...
     &   +                 RKI(   115 ) * YC ( MVK         )   ! HO+MVK=MVKP
     &   +                 RKI(   116 ) * YC ( UALD        )   ! HO+UALD=0.3130D+...
     &   +                 RKI(   118 ) * YC ( MGLY        )   ! HO+MGLY=ACO3+CO
     &   +    4.8000D-01 * RKI(   119 ) * YC ( DCB1        )   ! HO+DCB1=0.5200D+...
     &   +    4.8000D-01 * RKI(   120 ) * YC ( DCB2        )   ! HO+DCB2=0.5200D+...
     &   +    4.4000D-01 * RKI(   121 ) * YC ( DCB3        )   ! HO+DCB3=0.5600D+...
     &   +                 RKI(   122 ) * YC ( BALD        )   ! HO+BALD=BALP
     &   +    3.8100D-01 * RKI(   123 ) * YC ( PHEN        )   ! HO+PHEN=0.6190D+...
     &   +    4.1600D-01 * RKI(   124 ) * YC ( CSL         )   ! HO+CSL=0.5840D+...
     &   +                 RKI(   125 ) * YC ( MCT         )   ! HO+MCT=MCTO
     &   +    6.5000D-01 * RKI(   130 ) * YC ( OP1         )   ! HO+OP1=0.3500D+...
     &   +    9.9000D-01 * RKI(   131 ) * YC ( OP2         )   ! HO+OP2=0.1000D-...
     &   +    9.9000D-01 * RKI(   132 ) * YC ( OPB         )   ! HO+OPB=0.1000D-...
     &   +    9.9000D-01 * RKI(   133 ) * YC ( OP3         )   ! HO+OP3=0.1000D-...
     &   +                 RKI(   134 ) * YC ( MAHP        )   ! HO+MAHP=MACP
     &   +                 RKI(   136 ) * YC ( ORA2        )   ! HO+ORA2=0.6400D+...
     &   +    6.5000D-01 * RKI(   137 ) * YC ( PAA         )   ! HO+PAA=0.3500D+...
     &   +                 RKI(   138 ) * YC ( PAN         )   ! HO+PAN=XO2+NO3+HCHO
     &   +                 RKI(   139 ) * YC ( PPN         )   ! HO+PPN=XO2+NO3+HCHO
     &   +                 RKI(   140 ) * YC ( MPAN        )   ! HO+MPAN=NO2+HKET
     &   +                 RKI(   141 ) * YC ( ONIT        )   ! HO+ONIT=HC3P+NO2
     &   +                 RKI(   142 ) * YC ( TRPN        )   ! HO+TRPN=0.3300D+...
     &   +                 RKI(   143 ) * YC ( HONIT       )   ! HO+HONIT=HKET+NO3
     &   +                 RKI(   391 ) * YC ( VROCIOXY    )   ! HO+VROCIOXY=...
     &   +                 RKI(   392 ) * YC ( SLOWROC     )   ! HO+SLOWROC=ETHP+...
     &   +                 RKI(   393 ) * YC ( ACRO        )   ! HO+ACRO=0.5700D+...
     &   +    6.6700D-01 * RKI(   397 ) * YC ( BDE13       )   ! HO+BDE13=0.3330D+...
     &   +    5.1000D-01 * RKI(   405 ) * YC ( FURAN       )   ! HO+FURAN=0.4900D+...
     &   +    3.4000D-01 * RKI(   408 ) * YC ( FURANONE    )   ! HO+FURANONE=...
     &   +                 RKI(   417 ) * YC ( SESQ        )   ! HO+SESQ=SESQRO2
     &   +                 RKI(   433 ) * YC ( VROCP6ALK   )   ! HO+VROCP6ALK=...
     &   +                 RKI(   434 ) * YC ( VROCP5ALK   )   ! HO+VROCP5ALK=...
     &   +                 RKI(   435 ) * YC ( VROCP4ALK   )   ! HO+VROCP4ALK=...
     &   +                 RKI(   436 ) * YC ( VROCP3ALK   )   ! HO+VROCP3ALK=...
     &   +                 RKI(   437 ) * YC ( VROCP2ALK   )   ! HO+VROCP2ALK=...
     &   +                 RKI(   438 ) * YC ( VROCP1ALK   )   ! HO+VROCP1ALK=...
     &   +                 RKI(   439 ) * YC ( HC10        )   ! HO+HC10=HC10P
     &   +    8.4000D-01 * RKI(   489 ) * YC ( VROCP6ARO   )   ! HO+VROCP6ARO=...
     &   +    8.4000D-01 * RKI(   495 ) * YC ( VROCP5ARO   )   ! HO+VROCP5ARO=...
     &   +    8.4000D-01 * RKI(   501 ) * YC ( NAPH        )   ! HO+NAPH=0.1600D+...
     &   +                 RKI(   523 ) * YC ( ECH4        )   ! HO+ECH4=MO2
     &   +                 RKI(   526 ) * YC ( STY         )   ! HO+STY=STYP

      L4    = 1.0D0 + L4 * DTC + R5_4 + R19_4

c..HO2 loss terms not included in R4_5 & R21_5 (except for HO2+HO2 )
      L5 =                 RKI(    51 ) * YC ( HO          )   ! HO2+HO=
     &   +                 RKI(    58 ) * YC ( NO          )   ! HO2+NO=HNO3
     &   +    3.0000D-01 * RKI(    66 ) * YC ( NO3         )   ! HO2+NO3=0.7000D+...
     &   +    4.3000D-01 * RKI(    93 ) * YC ( ISOP        )   ! HO2+ISOP=0.5000D+...
     &   +    5.5000D-01 * RKI(    97 ) * YC ( INO2        )   ! HO2+INO2=0.4500D+...
     &   +                 RKI(   225 ) * YC ( MO2         )   ! HO2+MO2=OP1
     &   +                 RKI(   226 ) * YC ( ETHP        )   ! HO2+ETHP=OP2
     &   +                 RKI(   227 ) * YC ( HC3P        )   ! HO2+HC3P=OP2
     &   +                 RKI(   228 ) * YC ( HC5P        )   ! HO2+HC5P=OP2
     &   +                 RKI(   229 ) * YC ( ETEP        )   ! HO2+ETEP=OP2
     &   +                 RKI(   230 ) * YC ( OLTP        )   ! HO2+OLTP=OP2
     &   +                 RKI(   231 ) * YC ( OLIP        )   ! HO2+OLIP=OP2
     &   +                 RKI(   232 ) * YC ( BENP        )   ! HO2+BENP=0.6021D+...
     &   +                 RKI(   233 ) * YC ( TOLP        )   ! HO2+TOLP=0.7195D+...
     &   +                 RKI(   234 ) * YC ( XYLP        )   ! HO2+XYLP=0.4820D-...
     &   +                 RKI(   235 ) * YC ( EBZP        )   ! HO2+EBZP=0.8540D-...
     &   +    4.3950D-01 * RKI(   236 ) * YC ( APIP1       )   ! HO2+APIP1=...
     &   +                 RKI(   237 ) * YC ( APIP2       )   ! HO2+APIP2=HOM
     &   +    3.8050D-01 * RKI(   238 ) * YC ( APINP1      )   ! HO2+APINP1=...
     &   +                 RKI(   239 ) * YC ( APINP2      )   ! HO2+APINP2=HOM
     &   +    8.0000D-01 * RKI(   240 ) * YC ( LIMP1       )   ! HO2+LIMP1=...
     &   +                 RKI(   241 ) * YC ( LIMP2       )   ! HO2+LIMP2=HOM
     &   +    2.3000D-01 * RKI(   242 ) * YC ( LIMNP1      )   ! HO2+LIMNP1=...
     &   +                 RKI(   243 ) * YC ( LIMNP2      )   ! HO2+LIMNP2=HOM
     &   +    7.5000D-01 * RKI(   244 ) * YC ( PINALP      )   ! HO2+PINALP=...
     &   +    8.0000D-01 * RKI(   245 ) * YC ( LIMALP      )   ! HO2+LIMALP=...
     &   +    5.6000D-01 * RKI(   246 ) * YC ( ACO3        )   ! HO2+ACO3=0.4400D+...
     &   +    5.6000D-01 * RKI(   247 ) * YC ( RCO3        )   ! HO2+RCO3=0.4400D+...
     &   +    8.5000D-01 * RKI(   248 ) * YC ( ACTP        )   ! HO2+ACTP=0.1500D+...
     &   +                 RKI(   249 ) * YC ( MEKP        )   ! HO2+MEKP=OP2
     &   +                 RKI(   250 ) * YC ( KETP        )   ! HO2+KETP=OP2
     &   +                 RKI(   251 ) * YC ( MACP        )   ! HO2+MACP=MAHP
     &   +                 RKI(   252 ) * YC ( MCP         )   ! HO2+MCP=MAHP
     &   +                 RKI(   253 ) * YC ( MVKP        )   ! HO2+MVKP=OP2
     &   +                 RKI(   254 ) * YC ( UALP        )   ! HO2+UALP=OP2
     &   +                 RKI(   255 ) * YC ( ADDC        )   ! HO2+ADDC=OP2
     &   +                 RKI(   256 ) * YC ( CHO         )   ! HO2+CHO=CSL
     &   +                 RKI(   257 ) * YC ( MCTP        )   ! HO2+MCTP=OP2
     &   +                 RKI(   258 ) * YC ( ORAP        )   ! HO2+ORAP=OP2
     &   +                 RKI(   259 ) * YC ( OLNN        )   ! HO2+OLNN=ONIT
     &   +                 RKI(   260 ) * YC ( OLND        )   ! HO2+OLND=ONIT
     &   +                 RKI(   261 ) * YC ( ADCN        )   ! HO2+ADCN=OP2
     &   +                 RKI(   262 ) * YC ( XO2         )   ! HO2+XO2=OP2
     &   +                 RKI(   400 ) * YC ( BDE13P      )   ! HO2+BDE13P=OP2
     &   +    2.8000D-01 * RKI(   407 ) * YC ( FURANO2     )   ! HO2+FURANO2=...
     &   +                 RKI(   413 ) * YC ( SESQNRO2    )   ! HO2+SESQNRO2=...
     &   +                 RKI(   418 ) * YC ( SESQRO2     )   ! HO2+SESQRO2=...
     &   +                 RKI(   425 )                        ! HO2=
     &   +                 RKI(   454 ) * YC ( VROCP6ALKP  )   ! HO2+VROCP6ALKP=...
     &   +                 RKI(   455 ) * YC ( VROCP5ALKP  )   ! HO2+VROCP5ALKP=...
     &   +                 RKI(   456 ) * YC ( VROCP4ALKP  )   ! HO2+VROCP4ALKP=...
     &   +                 RKI(   457 ) * YC ( VROCP3ALKP  )   ! HO2+VROCP3ALKP=...
     &   +                 RKI(   458 ) * YC ( VROCP2ALKP  )   ! HO2+VROCP2ALKP=...
     &   +                 RKI(   459 ) * YC ( VROCP1ALKP  )   ! HO2+VROCP1ALKP=...
     &   +                 RKI(   460 ) * YC ( HC10P       )   ! HO2+HC10P=OP2
     &   +                 RKI(   482 ) * YC ( VROCP6ALKP2 )   ! HO2+VROCP6ALKP2=...
     &   +                 RKI(   483 ) * YC ( VROCP5ALKP2 )   ! HO2+VROCP5ALKP2=...
     &   +                 RKI(   484 ) * YC ( VROCP4ALKP2 )   ! HO2+VROCP4ALKP2=...
     &   +                 RKI(   485 ) * YC ( VROCP3ALKP2 )   ! HO2+VROCP3ALKP2=...
     &   +                 RKI(   486 ) * YC ( VROCP2ALKP2 )   ! HO2+VROCP2ALKP2=...
     &   +                 RKI(   487 ) * YC ( VROCP1ALKP2 )   ! HO2+VROCP1ALKP2=...
     &   +                 RKI(   488 ) * YC ( HC10P2      )   ! HO2+HC10P2=...
     &   +                 RKI(   490 ) * YC ( VROCP6AROP  )   ! HO2+VROCP6AROP=...
     &   +                 RKI(   496 ) * YC ( VROCP5AROP  )   ! HO2+VROCP5AROP=...
     &   +                 RKI(   502 ) * YC ( NAPHP       )   ! HO2+NAPHP=...
     &   +                 RKI(   527 ) * YC ( STYP        )   ! HO2+STYP=VROCP3OXY2

      L5    = 1.0D0 + L5 * DTC + R4_5 + R21_5

c..HONO loss terms not included in R4_19
      L19 =                 RKI(    60 ) * YC ( HO          )   ! HONO+HO=NO2

      L19   = 1.0D0 + L19 * DTC + R4_19

c..HNO4 loss terms not included in R5_21
      L21 =    2.0000D-01 * RKI(     9 )                        ! HNO4=0.8000D+...
     &    +                 RKI(    75 ) * YC ( HO          )   ! HNO4+HO=NO2

      L21   = 1.0D0 + L21 * DTC + R5_21

ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c  Solution section
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

c..compute terms used to calculate a,b & c
      L21_INV = 1.0D0 / L21
      T1 = 1.0D0 / ( L4 * L19 - R4_19 * R19_4 )
      T2 = R5_4 * T1
      T3 = R5_21 * L21_INV

c..solve quadratic equation for HO2
      A = 2.0D0 * ( RKI(    52 ) + RKI(    53 ) ) * DTC

      B = L5 - T3 * R21_5 - T2 * R4_5 * L19

      C = P5 + T3 * P21 + T2 * ( P4 * L19 + P19 * R4_19 )

      Q = -0.5D0 * ( B + SIGN( 1.0D0, B ) * SQRT( B * B + 4.0D0 * A * C ) )

      YCP( HO2 ) = MAX( Q / A , -C / Q  )

c..compute remaining species concentrations
      YCP( HO ) = ( ( P4 + R4_5 * YCP( HO2 ) ) * L19 + R4_19 * P19 ) * T1

      YCP( HNO4 ) = ( P21 + R21_5 * YCP( HO2 ) ) * L21_INV

      YCP( HONO ) = ( P19 + R19_4 * YCP( HO ) ) / L19

      RETURN

      END


